package com.dy.cloud.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;


/**
 * @ClassName:
 * @Author: 仄言in
 * @Desctiption: 统一返回类
 * @Date: 2021/6/2 9:39
 * @Version 1.0 (版本)
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
public class ApiResousUtil<T> {
    private String code;
    private String msg;
    private T data;
    public static<T> ApiResousUtil ok(T data){
        return new ApiResousUtil("200","success",data);
    }
    public static<T> ApiResousUtil ok(){
        return new ApiResousUtil("200","success",null);
    }
    public static<T> ApiResousUtil error(){
        return new ApiResousUtil("-100","error",null);
    }
    public static<T> ApiResousUtil error(T data){
        return new ApiResousUtil("-100","error",data);
    }
}
